Skip to content

🤖 tests: cover prepareTaskReservation paths before the split - #7717

Merged
ThomasK33 merged 6 commits into
mainfrom
refactor/task-prepare-tests
Oct 29, 2026
Merged

ThomasK33 merged 6 commits into
mainfrom
refactor/task-prepare-tests

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds 21 characterization tests for TaskService.prepareTaskReservation, with no production change. Line coverage of the method goes from 81 % (235 of 289 lines) to 98 %. Only a log.debug branch stays uncovered. This is the test PR at the start of stack 7 of the TaskService recovery and launch path split, from the "TaskService recovery and launch path plan" artifact, all defaults kept. The split PRs on top of it split the method (CC 62) into named steps.

What the tests cover

The new file is taskService.prepareTaskReservation.test.ts. All tests go through createMany on a local parent and use the existing harness. Every refusal test also checks that no workspace row was written and, where it applies, that nothing was sent.

  • Input: a malformed agent id. Six bad bestOf values are refused before the parent is read, and a valid bestOf is saved on the task row.

  • Parent gates: an unknown parent, an untrusted project, a parent that already reported, and a parent nested too deep for maxTaskNestingDepth.

  • Agents: a disabled agent, an unknown agent whose discovery fails, and a transport error while reading the definition.

  • AI settings:

    • An invalid explicit model is refused.
    • A transport error returns an error result.
    • Any other error propagates. A second createMany then finishes, which shows that the parent tree lock was released.
  • Conditions that line coverage missed: a parent exactly at maxTaskNestingDepth is accepted, and one deeper is refused. isolation: "none" on a local parent does not share the checkout. skip_init_hook decides whether a real .xum/init hook runs on launch. That test clears the project-automation kill switch and restores it.

Validation

  • The second commit came from a hand mutation run during the split. It covers three conditions whose mutants survived every test before. A fourth mutant, on the runnable-agents hint, changes only message text, so it has no test.
  • All 21 tests pass on the current code. They passed three runs in a row, and one run with XUM_DISABLE_PROJECT_AUTOMATION=1.
  • A scratch script made 24 edits to the production code, one per covered branch, and restored the file after each run. Each edit failed its own test.
  • The tests check short parts of the returned errors, such as the field name, as the merged 🤖 tests: cover createUnderTaskTreeLifecycleLock paths before the split #7701 does. They check no log text.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high • Cost: $257.41

Adds 18 characterization tests for TaskService.prepareTaskReservation
(the read-only preparation step of createMany), with no production
change. Line coverage of the method goes from 235/289 (81%) to 284/289
(98%). The five lines left are one log.debug branch.

Each test passes on the current code and fails under a scratch edit of
the branch it covers.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T22:13:42.963190Z 6d7e7ce Manual request
🔒 Security Review ✅ Completed 2026-10-29T22:14:09.591332Z 6d7e7ce Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 81452d33a8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 81452d33a8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🟢 e2e stories (Haiku): 14 passed

22 agent steps · 7 replayed from cache · 15 model calls · 46.3k tokens (24% cached)
Spend: $0.09 of the $1.00 cap (proxy ledger)

All 14 tests in 9 files
Test Agent Time
🟢 chatRestart.e2e.ts · 1 passed 1 step · 1 call 5.6s
🟢 a chat survives a restart of the server 1 step · 1 call 5.6s
🟢 compaction.e2e.ts · 1 passed 1 step · 1 call 4.3s
🟢 /compact replaces the old chat with a summary 1 step · 1 call 4.3s
🟢 pluginTrustRestart.e2e.ts · 1 passed 4 steps · 2 calls 11.2s
🟢 a trusted plugin hook stays trusted after the server restarts 4 steps · 2 calls 11.2s
🟢 settingsRoundTrip.e2e.ts · 1 passed 2 steps · 1 call 8.8s
🟢 a chat survives trips through Settings 2 steps · 1 call 8.8s
🟢 sidebarPerWorkspace.e2e.ts · 1 passed 4 steps · 1 call 5.2s
🟢 a new workspace starts with its right sidebar collapsed while another keeps it open 4 steps · 1 call 5.2s
🟢 smoke.e2e.ts · 1 passed 2 steps · 1 call 2.6s
🟢 the agent opens the playground workspace 2 steps · 1 call 2.6s
🟢 streamErrors.e2e.ts · 1 passed 1 step · 1 call 10.3s
🟢 stream errors show in the chat, and the chat recovers 1 step · 1 call 10.3s
🟢 todoNudge.e2e.ts · 1 passed 1 step · 1 call 3.2s
🟢 the agent finishes open TODO items after the turn-end nudge 1 step · 1 call 3.2s
🟢 touchAlignment.e2e.ts · 6 passed 6 steps · 6 calls 27.3s
🟢 the Settings close button is level with the title on a touch screen 390px wide 1 step · 1 call 4.0s
🟢 the Settings close button is level with the title on a touch screen 768px wide 1 step · 1 call 3.9s
🟢 Backup settings checkboxes are small and level with their labels on a touch phone 1 step · 1 call 5.5s
🟢 the heartbeat checkbox is small and level with its label on a touch phone 1 step · 1 call 3.9s
🟢 a reply's model and time stay on one line on a touch phone 1 step · 1 call 7.0s
🟢 the workspace actions menu stays on the title row on a touch phone 1 step · 1 call 3.0s

e2e 0.20.0 · 1m 21s · web · run artifacts

🟢 e2e Electron stories (Haiku): 3 passed

3 agent steps · 3 model calls · 8.0k tokens (22% cached)
Spend: $0.02 of the $1.00 cap (proxy ledger)

All 3 tests in 3 files
Test Agent Time
🟢 electron/deepLink.e2e.ts · 1 passed 1 step · 1 call 6.3s
🟢 a deep link of a second launch starts a chat in the running app 1 step · 1 call 6.3s
🟢 electron/menuBar.e2e.ts · 1 passed 1 step · 1 call 6.8s
🟢 the workspace menu bar is the desktop title bar 1 step · 1 call 6.8s
🟢 electron/smoke.e2e.ts · 1 passed 1 step · 1 call 5.6s
🟢 Xum Electron opens the playground workspace 1 step · 1 call 5.6s

e2e 0.20.0 · 21.0s · electron · run artifacts

🟢 e2e agent repros (Haiku): no tests selected

Spend: $0.00 of the $1.00 cap (proxy ledger)

e2e 0.20.0 · 5.4s · 2 targets (web, phone) · run artifacts

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 81452d33a8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 8387ab9734

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8387ab9734

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 2b0d44a7e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 2b0d44a7e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Oct 29, 2026
…receipt for the head (coder#7729)

## Summary

The `Codex Comments` gate (and so `Required`) no longer fails on a PR
where Codex's security review found nothing but finished with null
findings flags. The gate accepts that one state only beside a clean
security receipt for the current head, with no open Codex thread. Every
other unknown state still blocks.

Fixes coder#7727.

## Background

Since about 2026-10-28, Codex's summary board can record a finished
security review as `{"has_any_findings": null,
"has_unresolved_findings": null, "status": "completed"}`.
`codex_summary_status` accepted null flags only while a review runs, so
it returned unknown, and the board counted as an unresolved Codex
comment. Rerunning the job could not help. Open PRs coder#7722, coder#7724, coder#7723,
coder#7721 and coder#7717 all had this state on their latest board. coder#7722 is the
observed fixture.

## Implementation

`codex_summary_status` accepts a completed `security_review` with both
flags null only when ALL of these hold:

1. The review state's `commit_sha` is the PR's current head.
2. The board's security metadata line says `status: completed` for the
current head, with `mergeGateEnabled: false`.
3. The board has no `### Security findings` or advisory section.
4. An unminimized Codex comment is the clean security receipt ("Security
review completed. No security issues were found in this pull request.")
and names a reviewed commit that matches the current head. A receipt
without a commit line does not count here.
5. No Codex review thread is unresolved.

`check_codex_comments.sh` computes 4 and 5 and passes them as
`.clean_security_receipt`. A caller that does not set it gets the old
fail-closed behavior. The receipt regex moved into one shared
`codex_clean_security_receipt` def, so the informational check and this
check use the same text.

## Why the gate stays safe

- Null flags still block in every other case: a code review, an older
head, no receipt, a receipt for another commit, a minimized receipt, an
advisory section, the merge gate on, or an open Codex thread.
- The receipt is Codex's own verdict for that exact commit. It carries
no finding by construction: the regex is anchored and accepts only fixed
text.
- Findings never depend on the flags alone. Code and security findings
are review threads, and the gate counts open Codex threads separately.
Advisory findings are board bullets, and they block as before.
- A running review with null flags is unchanged: it still exits 10 (in
progress).

## Validation

- New test
`test_null_security_flags_pass_only_with_a_clean_receipt_for_this_head`,
run against the real shell entrypoint with the observed coder#7722 board and
receipt as fixtures (with and without the cached payload). Cases: clean
receipt for this head passes (0); no receipt (1); an open Codex thread
(1); a receipt for an older head (1); board and receipt for an older
head (1); an advisory section (1); the merge gate on (1); running with
null flags (10); a minimized receipt (1).
- On main, only the "clean receipt for this head" case fails (1 instead
of 0). Every blocking case blocks before and after.
- `make test-codex-comments` passes in full.
- A live run of `./scripts/check_codex_comments.sh 7722` with this
change: "No unresolved Codex comments found".

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$248.33`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=248.33 -->
@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 2b0d44a7e8

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 831f0bc061

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: 831f0bc061

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 831f0bc061

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Addresses Codex review on #7717: a test that fails before its own launch wait now still settles its scheduled launches before the root is removed.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: ebf1b347cc

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: ebf1b347cc

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebf1b347cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Addresses Codex review on #7717: setup now installs launch tracking for every test (refusal tests included), and the wait also covers markTaskLaunchFailed, which scheduleReservedTaskLaunch starts without awaiting when a launch rejects.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: 6d7e7ce545

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6d7e7ce545

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 5f1e2bf Oct 29, 2026
33 of 34 checks passed
@ThomasK33
ThomasK33 deleted the refactor/task-prepare-tests branch October 29, 2026 22:49
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Oct 30, 2026
…I settings and the result (coder#7723)

## Summary

Part 1 of 2: splits the tail of `TaskService.prepareTaskReservation` in
place into named steps, with no behaviour change. The tail covers the
agent definition read, the runnable-agents hint, the AI settings read
and the `Ok` result. The method drops from CC 62 to CC 47. On top of the
test PR coder#7717. 201 changed lines.

## Steps in this part

- `readReservationAgentDefinition` makes the definition read inside the
original try/catch. It calls the AI step after that try/catch, so an
AI-settings error is still not caught by the definition catch.
- `describeRunnableAgents` is the former `getRunnableHint` closure. Only
the refusal paths call it.
- `readReservationAiSettings` makes the AI settings read inside the
try/catch that rethrows, then builds the `Ok` literal unchanged.

## Rules every part keeps

- `prepareTaskReservation` keeps its signature. It runs under the parent
tree locks, before the global mutex, and takes no lock itself. No step
takes a lock.
- The steps form a chain: each step calls the next one directly after
its own last await, so no collaborator call runs a microtask later. Each
of the 4 abort checks is still the line right after its read, between
the same awaits.
- Only the result reaches `createManyUnderTaskTreeLifecycleLocks` later,
at approximately 2 to 3 microtasks per chain level. That caller then
checks `signal?.aborted` and releases the parent tree locks that much
later. Checks that run before the first await settle at the same time as
before.
- A script compared the old and new code: both have 10 awaits, 4
`readCancellable` calls, 4 `interruptedError()` calls and the same other
calls.
- Values cross the steps in readonly records built by spread. Every
value is set once, so no mutable record is needed.
- `make crap-check` against the parent commit reports 0 violations, with
and without coverage. Every new function scores CC 8 or less, and the
highest CRAP with coverage is 8.0.
- `bun test` on the taskService, ledger, workspaceTurnManager,
workflows, tools and workspaceService suites passes. The only failures
were 60 s timeouts in `workflowScriptDiscovery.test.ts`, which does not
import TaskService and scans this host's global skill folders. It passed
on the last part.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$257.41`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=257.41 -->
yermakoffivan pushed a commit to yermakoffivan/mux that referenced this pull request Oct 30, 2026
…7737)

## Summary

Adds 8 characterization tests for `TaskService.recoverInterruptedTasks`,
with no production change. Line coverage of the method goes from 93 %
(297 of 320 lines) to 100 %. This is the test PR at the start of stack 8
of the TaskService recovery and launch path split, from the "TaskService
recovery and launch path plan" artifact. The split PRs on top of it
split the method (CC 81) into named steps.

## What the tests cover

The new file is `taskService.recoverInterruptedTasks.test.ts`. Each test
runs a real startup recovery pass and checks which sends went out, which
tasks entered the completion prompt, and the row fields (attempt id,
status, pending guidance). No test checks log text.

- **Skips:** an `awaiting_report` task and a `running` task with a
blocking active descendant are not re-driven.
- **Another writer re-admits the row:** for an `awaiting_report` task,
before its attempt rotation and after its compaction follow-up. Nothing
is prompted for that task, and the next task still is.
- **Guidance replay:** a failed send stops that task's replay, keeps its
guidance pending, and the pass goes on. A replay whose attempt another
writer retired after the rotation sends nothing.
- **Restart nudge:** a failed nudge leaves the task running, and the
pass goes on to the next task.
- **Completion counters:** one recovery pass over 16 tasks, at least one
per outcome. The test reads the completion log's 8 counters and 2 task
counts by key, never the message. The split moves every counter, so this
pins counter drift. It failed under a scratch edit
(`skippedRunningAlreadyStreaming += 0`).

A second `Config` on the same root plays "another writer". It edits the
row right after a private step resolves (`settleChildGoalPause` or
`dispatchFencedStartupCompactionFollowUp`).

## Validation

- A scratch edit of each covered branch (a dropped `continue` or
`break`, a `continue` turned into `return`, a disabled guard) failed its
test. I restored the file after each edit.
- The new file passed 70 runs (`--rerun-each 10`).
- Teardown waits for every queue drain, launch and launch-failure
handler the test started, also when a test fails early. Stack 7's test
PR (coder#7717) needed three Codex rounds on this, so setup installs the
tracking for every test.

---

_Generated with `xum` • Model: `anthropic:claude-opus-5-5` • Thinking:
`high` • Cost: `$280.84`_

<!-- mux-attribution: model=anthropic:claude-opus-5-5 thinking=high
costs=280.84 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant